//
//  SZZStatusViewModel.swift
//  SZZweibo
//
//  Created by 申壮壮 on 16/8/17.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class SZZStatusViewModel: NSObject {

    
    //创建一个对象
    var statusModel:SZZtatusModel?
    
    //微博等级图片
    var mbranrkImage: UIImage?
    
    //认证图片
    var verifiedImage: UIImage?
    
    init (statusModel: SZZtatusModel){
        
        super.init()
        
        self.statusModel = statusModel
        
        mbranrkImage = dealMbrankImage(statusModel.user?.mbrank ?? 0)
        verifiedImage = dealVerifiedImage(statusModel.user?.verified ?? -1)
    }
    
}
extension SZZStatusViewModel{

func dealMbrankImage(mbrank: Int) -> UIImage?{
        if mbrank > 0 && mbrank < 7 {
            return UIImage(named: "common_icon_membership_level\(mbrank)")
        }
        return UIImage(named: "common_icon_membership")
    }

    func dealVerifiedImage(verified: Int) -> UIImage?{
        switch verified{
        case 1:
            return UIImage(named: "avatar_vip")
        case 2,3,5:
            return UIImage(named: "avatar_enterprise_vip")
        case 220:
            return UIImage(named: "avatar_grassroot")
        default:
            return UIImage(named: "avatar_vgirl")
        }
    }

    
}
